import axiosInstance from "../axiosInstance"

const goodsInfo = {
    /**
     * 根据父级id获取商品分类
     * @param  parent_id 
     * @returns 
     */
    getListByParentId(parent_id) {
        return axiosInstance.get(`/goodsInfo/getListByParentId/${parent_id}`);
    },
    /**
     * 根据id获取商品信息
     * @param  id 
     * @returns 
     */
    findById(id) {
        return axiosInstance.get(`/goodsInfo/findById/${id}`);
    },
    /**
     * 获取推荐的商品
     * @returns 
     */
    getRecommendGoodsList() {
        return axiosInstance.get(`/goodsInfo/getRecommendGoodsList`);
    },
    /**
     * 分页查询商品信息
     * @param {goods_name, goods_status, products_id, goods_price_low, goods_price_high, pageIndex} param0 
     * @returns 
     */
    getListByPage({ goods_name, goods_status, products_id, goods_price_low, goods_price_high, pageIndex }) {
        return axiosInstance.get(`/goodsInfo/getListByPage`, {
            params: {
                goods_name, goods_status, products_id, goods_price_low, goods_price_high, pageIndex
            }
        })
    }
}

export default goodsInfo;